<template>
  <div class="header">
    <div class="header-left">
      <span class="iconfont back-icon">&#xe624;</span>
    </div>
    <div class="header-input">
      <span class="iconfont">&#xe632;</span>
      请输入城市/景点/游玩主题
    </div>
    <router-link to="/city">
      <div class="header-right">
        {{city}}
        <span class="iconfont city-icon">&#xe64a;</span>
      </div>
    </router-link>
  </div>
</template>

<script>
import {mapState} from 'vuex'
  export default {
    computed: {
      // 把vuex中的city数据映射到该组件的computed当中，使用{{city}}即可得到数据
      ...mapState(['city'])
    },
  }
</script>

<style lang="stylus" scoped>
@import '~@/assets/css/global.styl'
.header
  display flex
  line-height $headerHeight
  color #fff
  background $bgColor
  .header-left
    width .64rem
    float left
    .back-icon
      display block
      font-size .4rem
      text-align center
  .header-input
    flex 1
    color #ccc
    height .64rem
    line-height .64rem
    margin-top .12rem
    margin-left .2rem
    padding-left .2rem
    background #fff
    border-radius .1rem
  .header-right
    color #fff
    min-width 1.24rem
    padding 0 .1rem
    float right
    text-align center
    .city-icon
      font-size .24rem
</style>